/*
 * Created on 26.11.2003
 * Local Projects Database
 * Mihai Postelnicu (mihai@ro-gateway.org)
 * (c) 2003 by eRomania Gateway
 */
package ro.gateway.aida.utils;

import java.util.ArrayList;
import java.util.Iterator;



/**
 *
 * @author Mihai Postelnicu<p>
 *
 *  e-mail (mihai@ro-gateway.org)<br>
 * (c) 2003 by eRomania Gateway<p>
 */
public class LocalisedList extends ArrayList implements Localizable
{
      protected String viewLang;

      public LocalisedList( String lang )
      {
            this.viewLang = lang;
      }

      public LocalisedList()
      {
      }


      public boolean add( Localizable item )
      {
            if ( viewLang != null ) item.setViewLang( viewLang );
            return super.add( item );
      }

      public void setViewLang( String lang )
      {
            Iterator i = iterator();
            this.viewLang = lang;
            while ( i.hasNext() )
            {
            	Localizable item = ( Localizable ) i.next();
                  item.setViewLang( lang );
            }
      }

      public String getViewLang()
      {
            return viewLang;
      }
}
